From e1054557f90f9ec1552fa5e75b302acbd5b069cb Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 19 Nov 2008 13:17:31 +0000 Subject: [PATCH] x86, s3: Sync platform stamps at time suspend. platform_timer_stamp and stime_platform_stamp are synced to platform timer in time calibration (1s interval), and thus doesn't reflect the latest value. If they're not synced at time suspend, the offset can be lost after S3 resume. Average 0.8s lag-behind is observed for each S3 action, which accumulates to TOD inaccuracy. Signed-off-by Kevin Tian --- xen/arch/x86/time.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 806045a359..f895ece5e7 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -585,8 +585,7 @@ static void resume_platform_timer(void) if ( plt_src.resume ) plt_src.resume(&plt_src); - /* No change in platform_stime across suspend/resume. */ - platform_timer_stamp = plt_stamp64; + plt_stamp64 = platform_timer_stamp; plt_stamp = plt_src.read_counter(); } @@ -1221,6 +1220,9 @@ int time_suspend(void) cmos_utc_offset = -get_cmos_time(); cmos_utc_offset += (wc_sec + (wc_nsec + NOW()) / 1000000000ULL); kill_timer(&calibration_timer); + + /* Sync platform timer stamps. */ + platform_time_calibration(); } /* Better to cancel calibration timer for accuracy. */ -- 2.30.2